package com.xh.demo.common.exception;

import com.xh.demo.common.message.ICommonMessage;

/**
 * @Name BusinessException
 * @Description 全局异常类
 * @Author wen
 * @Date 2019-08-01
 */
public class BusinessException extends RuntimeException implements ICommonMessage {

    private int code;

    private String msg;

    public BusinessException(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    public BusinessException(ICommonMessage cm){
        this(cm.getCode(), cm.getMsg());
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.msg;
    }

}
